import { ref } from "vue";
import { defineStore } from "pinia";
import { getCategoryAPI } from '@/apis/layout'

//useCounterStore是一个函数，调用它会返回一个对象，这个对象就是store
export const useCategoryStore = defineStore("category", () => {
    //组合式的写法 更灵活但是更复杂
    const categoryList = ref([])

    const getCategory = async () => {
        const res = await getCategoryAPI()
        categoryList.value = res.result
    }
    
    return { categoryList,getCategory };
});